<%--
  Created by IntelliJ IDEA.
  User: 李元峰
  Date: 2022/9/20
  Time: 15:43
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<!doctype html>
<html lang="en" class="pxp-root">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link rel="shortcut icon" href="/static/web/images/favicon.png" type="image/x-icon">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600;700&display=swap" rel="stylesheet">
    <link href="/static/web/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/web/css/font-awesome.min.css">
    <link rel="stylesheet" href="/static/web/css/owl.carousel.min.css">
    <link rel="stylesheet" href="/static/web/css/owl.theme.default.min.css">
    <link rel="stylesheet" href="/static/web/css/animate.css">
    <link rel="stylesheet" href="/static/web/css/style.css">
    <link rel="stylesheet" href="/static/web/css/iconcss/iconfont.css">
    <style>
        * {
            padding: 0px;
            margin: 0px;
        }
        /* 弹窗背景 */
        #modal {
            width: 100%;
            height: 100%;
            /* 默认隐藏 */
            /* display: none; */
            /* 固定定位 */
            position: fixed;
            /* 设置在顶层 */
            z-index: 1000;
            /* 设置位置 */
            left: 0;
            top: 0;
            overflow: auto;
            background-color: rgba(0, 0, 0, 0.4);
        }
        /* 弹窗内容 */
        #modal-content {
            position: relative;
            background-color: #fff;
            margin: 1% auto;
            border: 1px solid #888;
            width: 700px;
            height: 900px;
            z-index: 1001;
        }
        /* 关闭按钮 */
        #close {
            position: absolute;
            right: 20px;
            color: #aaa;
            float: right;
            font-size: 28px;
            font-weight: bold;
        }
        /* 设置关闭按钮的鼠标指针 */
        #close:hover,
        #close:focus {
            color: black;
            text-decoration: none;
            cursor: pointer;
        }
    </style>

    <title>个人简历</title>
</head>
<body style="background-color: var(--pxpSecondaryColorLight);">
<jsp:include page="/web/personal/inc/personalCenterHead"></jsp:include>

    <div class="pxp-dashboard-content-details">
        <h1>个人简历</h1>
        <p class="pxp-text-light">编写您的候选人简历</p>
        <span id="success_msg" style="color:red;"></span>
        <div style="display: flex;">
            <button class="btn rounded-pill pxp-section-cta" id="yuLanButton">预览简历</button>
            <p class="pxp-text-light" style="margin-top: 10px;margin-left: 10px;">预览简历只会显示保存后的简历</p>
        </div>
        <form id="myform" method="post" enctype="multipart/form-data" action="/web/personal/insertProfile">
            <input type="hidden" name="resume" value="true"/>
            <div class="row mt-4 mt-lg-5">
                <h2>基本信息</h2><div><button class="btn rounded-pill pxp-subsection-cta" id="ji-stow" type="button">展 开</button></div> <span id="ji_msg" class="ori-row" style="color: red;"></span>
                <div class="col-xxl-8 essential-information" style="display: none;">
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-name" class="form-label">姓名 <span style="color: red;" id="name_msg"></span></label>
                                <input type="text" id="pxp-candidate-name" class="form-control" placeholder="添加您的真实姓名" name="name" value="${requestScope.user.name}">
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-sex" class="form-label">性别 <span style="color: red;" id="sex_msg"></span></label>
                                <select id="pxp-candidate-sex" class="form-select" name="sex">
                                    <option selected disabled hidden>请选择</option>
                                    <option>男</option>
                                    <option>女</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-school" class="form-label">毕业院校 <span style="color: red;" id="school_msg"></span></label>
                                <input type="text" id="pxp-candidate-school" class="form-control" placeholder="输入您的毕业院校" name="school" value="${requestScope.user.school}">
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-major" class="form-label">专业 <span style="color: red;" id="major_msg"></span></label>
                                <input type="tel" id="pxp-candidate-major" class="form-control" placeholder="输入您的专业" name="major" value="${requestScope.user.major}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-email" class="form-label">邮箱 <span style="color: red;" id="email_msg"></span></label>
                                <input type="email" id="pxp-candidate-email" class="form-control" placeholder="请输入您的邮箱" name="email" value="${requestScope.user.email}">
                            </div>
                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-phone" class="form-label">手机号码 <span style="color: red;" id="phone_msg"></span></label>
                                <input type="tel" id="pxp-candidate-phone" class="form-control" placeholder="请输入您的电话号码" name="phone" value="${requestScope.user.phone}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-birth" class="form-label">生日 <span style="color: red;" id="birth_msg"></span></label>
                                <input type="date" id="pxp-candidate-birth" class="form-control" name="birthday" value="<fmt:formatDate value='${requestScope.user.birthday}' pattern='yyyy-MM-dd'/>">
                            </div>

                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-qq" class="form-label">qq <span style="color: red;" id="qq_msg"></span></label>
                                <input type="text" id="pxp-candidate-qq" class="form-control" placeholder="请输入您的qq地址" name="qq" value="${requestScope.user.qq}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-national" class="form-label">民族 <span style="color: red;" id="national_msg"></span></label>
                                <input type="text" id="pxp-candidate-national" class="form-control" name="national" placeholder="请输入您的民族" value="${requestScope.user.national}">
                            </div>

                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-marry" class="form-label">婚姻状况 <span style="color: red;" id="marry_msg"></span></label>
                                <input type="text" id="pxp-candidate-marry" class="form-control" placeholder="请输入您的婚姻状况" name="marriage" value="${requestScope.user.marriage}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-place" class="form-label">籍贯 <span style="color: red;" id="place_msg"></span></label>
                                <input type="text" id="pxp-candidate-place" class="form-control" name="nativePlace" placeholder="请输入您的籍贯" value="${requestScope.user.nativePlace}">
                            </div>

                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-now" class="form-label">现居地 <span style="color: red;" id="now_msg"></span></label>
                                <input type="text" id="pxp-candidate-now" class="form-control" placeholder="请输入您的现居地" name="nowIn" value="${requestScope.user.nowIn}">
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-excepted-pol" class="form-label">政治面貌 <span style="color: red;" id="pol_msg"></span></label>
                                <input type="text" id="pxp-candidate-excepted-pol" class="form-control" placeholder="请输入您的政治面貌" name="politicalLandscape" value="${requestScope.user.politicalLandscape}"/>
                            </div>

                        </div>
                        <div class="col-sm-6">
                            <div class="mb-3">
                                <label for="pxp-candidate-excepted-status" class="form-label">求职状态 <span style="color: red;" id="status_msg"></span></label>
                                <select id="pxp-candidate-excepted-status" class="form-select" name="jobStatusId">
                                    <option value="0" disabled selected hidden>请选择</option>
                                    <c:forEach items="${requestScope.jobStatuses}" var="jobstatus">
                                        <option value="${jobstatus.id}">${jobstatus.jobStatusInfo}</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-xxl-4 essential-information" style="display: none;">
                    <div class="form-label">&nbsp;</div>
<%--                    <div class="pxp-candidate-cover mb-3">--%>
<%--                        <input type="file" id="pxp-candidate-cover-choose-file" accept="image/*">--%>
<%--                        <label for="pxp-candidate-cover-choose-file" class="pxp-cover"><span>上传封面图片</span></label>--%>
<%--                    </div>--%>
                    <div class="pxp-candidate-photo mb-3">
                        <span style="color: red;" id="fileUp"></span>
                        <input type="file" id="pxp-candidate-photo-choose-file" name="pic" accept="image/*">
                        <label for="pxp-candidate-photo-choose-file" id="yu_lan" class="pxp-cover" style="width: 200px;height: 250px;"><span>上传<br>照片</span></label>
                    </div>
                </div>
            </div>

            <div class="mb-3 essential-information" style="display: none">
                <label for="pxp-candidate-about" class="form-label">关于你的详细信息 <span style="color: red;" id="about_msg"></span></label>
                <textarea class="form-control" id="pxp-candidate-about" placeholder="在此处输入您的信息..." name="introduction">${requestScope.user.introduction}</textarea>
            </div>
            <button class="btn rounded-pill pxp-subsection-cta essential-information" id="addInfo" type="button" style="display: none;">保存基本信息</button>
            <div class="mt-4 mt-lg-5">
                <h2>技能</h2><div><button class="btn rounded-pill pxp-subsection-cta" id="tec_stow" type="button">展 开</button></div> <span style="color: red" id="tec_msg"></span>
                <div class="pxp-candidate-dashboard-skills mb-3 tec-row" style="display: none;">
                    <ul class="list-unstyled" id="exist_tec">
                        <c:forEach items="${requestScope.technologies}" var="technology">
                            <li><span class="label">${technology.technologyLabel}</span><span class="fa fa-trash-o delTec" data-id="${technology.id}"></span></li>
                        </c:forEach>
                    </ul>
                </div>
                <div class="input-group mb-3 but tec-flex" style="display: none;">
                    <input type="text" class="form-control" placeholder="技能" id="tec">
                    <button class="btn" id="addTec" type="button">添加技能</button>
                </div>
            </div>

            <div class="mt-4 mt-lg-5 height">
                <h2>工作意向</h2><div><button class="btn rounded-pill pxp-subsection-cta" id="ori-stow" type="button">展 开</button></div> <span id="ori_msg" class="ori-row" style="color: red;"></span>
                <div class="table-responsive">
                    <table class="table align-middle ori" style="display:none;">
                        <c:forEach items="${requestScope.jobOrientations}" var="jobOrientation" varStatus="stat">
                            <tr>
                                <td style="width: 20%;"><div class="pxp-candidate-dashboard-ori-position-type-second" data-val="${jobOrientation.positionTypeSecond.id}">${jobOrientation.positionTypeSecond.typeName}</div></td>
                                <td style="width: 20%;"><div class="pxp-candidate-dashboard-ori-position-type" data-val="${jobOrientation.positionType.id}">${jobOrientation.positionType.typeName}</div></td>
                                <td style="width: 20%;"><div class="pxp-candidate-dashboard-ori-city" data-val="${jobOrientation.city.cityId}">${jobOrientation.city.province.provName}${jobOrientation.city.cityName}</div></td>
                                <td style="width: 20%;"><div class="pxp-candidate-dashboard-ori-salary" data-val="${jobOrientation.salary.id}">${jobOrientation.salary.salaryInfo}</div></td>
                                <td style="width: 20%;"><div class="pxp-candidate-dashboard-ori-work-nature" data-val="${jobOrientation.workNature}"><c:if test="${jobOrientation.workNature}" var="nature">全职</c:if><c:if test="${not nature}">兼职</c:if> </div></td>
                                <td>
                                    <div class="pxp-dashboard-table-options">
                                        <ul class="list-unstyled">
                                            <li><button title="修改" type="button" class="updateOri" data-id="${jobOrientation.id}"><span class="fa fa-pencil"></span></button></li>
                                            <li><button title="删除" type="button" class="delOri" data-id="${jobOrientation.id}"><span class="fa fa-trash-o"></span></button></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </div>
                <div class="row mt-3 mt-lg-4 ori-row" style="display: none;">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-ori-position-type" class="form-label">期望行业</label>
                            <select id="pxp-candidate-ori-position-type" class="form-select">
                                <option selected disabled hidden value="0">请选择</option>
                                <c:forEach items="${requestScope.positionTypes}" var="positionType">
                                    <option value="${positionType.id}">${positionType.typeName}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-ori-position-type-second" class="form-label">期望类型</label>
                            <select id="pxp-candidate-ori-position-type-second" class="form-select">
                                <option selected disabled hidden value="0">请先选择期望行业</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-ori-prov" class="form-label">期望省份</label>
                            <select id="pxp-candidate-ori-prov" class="form-select">
                                <option value="0" selected disabled hidden>请选择</option>
                                <c:forEach items="${requestScope.provinces}" var="province">
                                    <option value="${province.provId}">${province.provName}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row mt-3 mt-lg-4 ori-row" style="display: none;">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-ori-city" class="form-label">期望城市</label>
                            <select id="pxp-candidate-ori-city" class="form-select">
                                <option value="0" disabled selected hidden>请先选择省份</option>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-ori-salary" class="form-label">期望薪资</label>
                            <select id="pxp-candidate-ori-salary" class="form-select">
                                <option value="0" selected disabled hidden>请选择</option>
                                <c:forEach items="${requestScope.salaries}" var="salary">
                                    <option value="${salary.id}">${salary.salaryInfo}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-ori-work-nature" class="form-label">工作性质</label>
                            <select id="pxp-candidate-ori-work-nature" class="form-select">
                                <option value="true">全职</option>
                                <option value="false">兼职</option>
                            </select>
                        </div>
                    </div>
                </div>
                <button class="btn rounded-pill pxp-subsection-cta ori-input" id="addOri" type="button" style="display: none;">添加工作意向</button>
            </div>
            <div class="mt-4 mt-lg-5 weight">
                <h2>工作经验</h2><div><button class="btn rounded-pill pxp-subsection-cta" id="stow" type="button">展 开</button></div> <span id="exp_msg" class="exp-row" style="color: red;"></span>
                <div class="table-responsive">
                    <table class="table align-middle exp" style="display: none;">
                        <c:forEach items="${requestScope.workExperiences}" var="workExperience" varStatus="stat">
                                <tr>
                                    <td style="width: 30%;"><div class="pxp-candidate-dashboard-experience-title">${workExperience.name}</div></td>
                                    <td style="width: 20%;"><div class="pxp-candidate-dashboard-experience-company">${workExperience.companyName}</div></td>
                                    <td style="width: 20%;"><div class="pxp-candidate-dashboard-experience-time" data-in="<fmt:formatDate value='${workExperience.inServiceTime}' pattern='yyyy-MM'/>" data-out="<fmt:formatDate value='${workExperience.outServiceTime}' pattern='yyyy-MM'/>"><fmt:formatDate value="${workExperience.inServiceTime}" pattern="yyyy年MM月"/> - <fmt:formatDate value="${workExperience.outServiceTime}" pattern="yyyy年MM月"/></div></td>
                                    <td style="width: 40%;"><div class="pxp-candidate-dashboard-experience-introduction" data-position="${workExperience.positionTypeSecondId}">${workExperience.jobDescription}</div></td>
                                    <td>
                                        <div class="pxp-dashboard-table-options">
                                            <ul class="list-unstyled">
                                                <li><button title="修改" type="button" class="updateExp" data-id="${workExperience.id}"><span class="fa fa-pencil"></span></button></li>
                                                <li><button title="删除" type="button" class="delExp" data-id="${workExperience.id}"><span class="fa fa-trash-o"></span></button></li>
                                            </ul>
                                        </div>
                                    </td>
                                </tr>
                        </c:forEach>
                    </table>
                </div>
                <div class="row mt-3 mt-lg-4 exp-row" style="display: none;">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-work-title" class="form-label">职称</label>
                            <input type="text" id="pxp-candidate-work-title" class="form-control" placeholder="请输入您的职称">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-work-company" class="form-label">公司名称</label>
                            <input type="text" id="pxp-candidate-work-company" class="form-control" placeholder="请输入公司名称">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-work-time" class="form-label">加入时间</label>
                            <input type="month" id="pxp-candidate-work-time" class="form-control" placeholder="请选择加入时间">
                        </div>
                    </div>
                </div>
                <div class="row mt-3 mt-lg-4 exp-row" style="display: none;">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-work-endTime" class="form-label">离职时间</label>
                            <input type="month" id="pxp-candidate-work-endTime" class="form-control" placeholder="请选择离职时间">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-work-type" class="form-label">公司类型</label>
                            <select id="pxp-candidate-work-type" class="form-select">
                                <c:forEach items="${requestScope.positionTypes}" var="positionType">
                                    <option value="${positionType.id}">${positionType.typeName}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-work-type-second" class="form-label">职位类型</label>
                            <select id="pxp-candidate-work-type-second" class="form-select">

                            </select>
                        </div>
                    </div>
                </div>
                <div class="mb-3  exp-input" style="display: none;">
                    <label for="pxp-candidate-work-about" class="form-label">描述</label>
                    <textarea class="form-control pxp-smaller" id="pxp-candidate-work-about" placeholder="在这儿写简单描述..."></textarea>
                </div>
                <button class="btn rounded-pill pxp-subsection-cta exp-input" id="addExp" type="button" style="display: none;">添加经历</button>
            </div>

            <div class="mt-4 mt-lg-5 might">
                <h2>教育或培训经历</h2> <div><button type="button" id="edu-stow" class="btn rounded-pill pxp-subsection-cta">展 开</button></div><span style="color: red;" class="edu-row" id="edu_msg"></span>
                <div class="table-responsive">
                    <table class="table align-middle edu" style="display: none;">
                        <c:forEach items="${requestScope.educationExperiences}" var="educationExperience">
                            <tr>
                                <td style="width: 30%;"><div class="pxp-candidate-dashboard-experience-title">${educationExperience.schoolName}</div></td>
                                <td style="width: 25%;"><div class="pxp-candidate-dashboard-experience-school">${educationExperience.introduction}</div></td>
                                <td style="width: 25%;"><div class="pxp-candidate-dashboard-experience-time" data-begin="<fmt:formatDate value='${educationExperience.beginTime}' pattern='yyyy-MM'/>" data-end="<fmt:formatDate value='${educationExperience.endTime}' pattern='yyyy-MM'/>"><fmt:formatDate value="${educationExperience.beginTime}" pattern="yyyy年MM月"/> - <fmt:formatDate value="${educationExperience.endTime}" pattern="yyyy年MM月"/> </div></td>
                                <td>
                                    <div class="pxp-dashboard-table-options">
                                        <ul class="list-unstyled">
                                            <li><button title="修改" type="button" class="updateEdu" data-id="${educationExperience.id}"><span class="fa fa-pencil"></span></button></li>
                                            <li><button title="删除" type="button" class="delEdu" data-id="${educationExperience.id}"><span class="fa fa-trash-o"></span></button></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </div>

                <div class="row mt-3 mt-lg-4 edu-row" style="display: none;">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-edu-school" class="form-label">学校名称</label>
                            <input type="text" id="pxp-candidate-edu-school" class="form-control" placeholder="请输入您的学校名称">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-edu-begin" class="form-label">开始时间</label>
                            <input type="month" id="pxp-candidate-edu-begin" class="form-control">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-edu-end" class="form-label">毕业时间</label>
                            <input type="month" id="pxp-candidate-edu-end" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="mb-3 edu-input" style="display: none;">
                    <label for="pxp-candidate-edu-about" class="form-label">描述</label>
                    <textarea class="form-control pxp-smaller" id="pxp-candidate-edu-about" placeholder="在此输入简短描述..."></textarea>
                </div>
                <button class="btn rounded-pill pxp-subsection-cta edu-input" type="button" id="addEdu" style="display: none;">添加教育经历</button>
            </div>

            <div class="mt-4 mt-lg-5 kight">
                <h2>学生干部经历</h2><div><button type="button" class="btn rounded-pill pxp-subsection-cta" id="cad-stow">展 开</button></div> <span style="color: red;" class="cad-row" id="cad_msg"></span>
                <div class="table-responsive">
                    <table class="table align-middle cad" style="display: none;">
                        <c:forEach items="${requestScope.studentCadreExperiences}" var="studentCadreExperience">
                            <tr>
                                <td style="width: 30%;"><div class="pxp-candidate-dashboard-cadre-rank">${studentCadreExperience.rankOfCadre}</div></td>
                                <td style="width: 25%;"><div class="pxp-candidate-dashboard-cadre-about">${studentCadreExperience.introduction}</div></td>
                                <td style="width: 25%;"><div class="pxp-candidate-dashboard-cadre-time" data-begin="<fmt:formatDate value='${studentCadreExperience.beginTime}' pattern='yyyy-MM'/>" data-end="<fmt:formatDate value='${studentCadreExperience.endTime}' pattern='yyyy-MM'/>"><fmt:formatDate value="${studentCadreExperience.beginTime}" pattern="yyyy年MM月"/> - <fmt:formatDate value="${studentCadreExperience.endTime}" pattern="yyyy年MM月"/> </div></td>
                                <td>
                                    <div class="pxp-dashboard-table-options">
                                        <ul class="list-unstyled">
                                            <li><button title="修改" type="button" class="updateCad" data-id="${studentCadreExperience.id}"><span class="fa fa-pencil"></span></button></li>
                                            <li><button title="删除" type="button" class="delCad" data-id="${studentCadreExperience.id}"><span class="fa fa-trash-o"></span></button></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </div>

                <div class="row mt-3 mt-lg-4 cad-row" style="display: none;">
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-edu-school" class="form-label">干部名称</label>
                            <input type="text" id="pxp-candidate-cad-rank" class="form-control" placeholder="请输入您的干部名称">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-edu-begin" class="form-label">开始时间</label>
                            <input type="month" id="pxp-candidate-cad-begin" class="form-control">
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="mb-3">
                            <label for="pxp-candidate-edu-end" class="form-label">结束时间</label>
                            <input type="month" id="pxp-candidate-cad-end" class="form-control">
                        </div>
                    </div>
                </div>
                <div class="mb-3 cad-input" style="display: none;">
                    <label for="pxp-candidate-edu-about" class="form-label">描述</label>
                    <textarea class="form-control pxp-smaller" id="pxp-candidate-cad-about" placeholder="在此输入简短描述..."></textarea>
                </div>
                <button class="btn rounded-pill pxp-subsection-cta cad-input" type="button" id="addCad" style="display: none;">添加学生干部经历</button>
            </div>

            <div class="mt-4 mt-lg-5">
                <h2>所获荣誉</h2><div><button class="btn rounded-pill pxp-subsection-cta" id="hor_stow" type="button">展 开</button></div><span style="color: red" id="hor_msg"></span>
                <div class="pxp-candidate-dashboard-skills mb-3 hor-row" style="display: none;">
                    <ul class="list-unstyled" id="exist_hor">
                        <c:forEach items="${requestScope.honorsWons}" var="honorsWon">
                            <li><span class="label">${honorsWon.honorsWonInfo}</span><span class="fa fa-trash-o delHor" data-id="${honorsWon.id}"></span></li>
                        </c:forEach>
                    </ul>
                </div>
                <div class="input-group mb-3 but hor-flex" style="display: none;">
                    <input type="text" class="form-control" placeholder="所获荣誉" id="hor">
                    <button class="btn" id="addHor">添加荣誉</button>
                </div>
            </div>
<%--            <div class="mt-4 mt-lg-5">--%>
<%--                <h2>设置简历状态</h2><div><button class="btn rounded-pill pxp-subsection-cta" id="set_stow" type="button">展 开</button></div><span style="color: red" id="set_msg"></span>--%>
<%--                <div class="input-group mb-3 but set-flex" style="display: none;">--%>
<%--                    <button class="btn" id="addSet">私密</button>--%>
<%--                </div>--%>
<%--            </div>--%>
        </form>
    </div>
    <div id="modal">
        <!-- 弹窗 -->
        <div id="modal-content" style="overflow: scroll;">
            <span id="yu_lan_title">预览简历</span>
            <span id="close">&times;</span>
            <div id="yu_lan_info">
                <div id="yu_lan_face">
                    <img src="/static/uploadImages/${requestScope.user.face}" id="face_pic"/>
                </div>
                <div>
                    <h3 id="user_name">${requestScope.user.name}</h3>
                </div>
                <div>
                    ${requestScope.user.sex}|<span id="user_age"></span>|${requestScope.user.school}
                </div>
                <div id="user_lianXi">
                    <i class="iconfont">&#xe88b;</i>${requestScope.user.phone} &nbsp;&nbsp;&nbsp;<i class="iconfont">&#xe908;</i>${requestScope.user.email}
                </div>
            </div>
            <div id="user_info">
                <h4 id="user_info_title">个人信息详细</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="user_major">
                    <ul>
                        <li id="li_a">所学专业：<c:if test="${requestScope.user.major==null||requestScope.user.major==''}" var="inMajor">未填</c:if><c:if test="${not inMajor}">${requestScope.user.major}</c:if></li>
                        <li>qq账号:<c:if test="${requestScope.user.qq==null||requestScope.user.qq==''}" var="inQQ">未填</c:if><c:if test="${not inQQ}">${requestScope.user.qq}</c:if></li>
                        <li>民族:<c:if test="${requestScope.user.national==null||requestScope.user.national==''}" var="inNa">未填</c:if><c:if test="${not inNa}">${requestScope.user.national}</c:if></li>
                        <li>婚姻状况:<c:if test="${requestScope.user.marriage==null||requestScope.user.marriage==''}" var="inMa">未填</c:if><c:if test="${not inMa}">${requestScope.user.marriage}</c:if></li>
                        <li>现居地:<c:if test="${requestScope.user.nowIn==null||requestScope.user.nowIn==''}" var="inNow">未填</c:if><c:if test="${not inNow}">${requestScope.user.nowIn}</c:if></li>
                        <li>籍贯:<c:if test="${requestScope.user.nativePlace==null||requestScope.user.nativePlace==''}" var="inPl">未填</c:if><c:if test="${not inPl}">${requestScope.user.nativePlace}</c:if></li>
                        <li>政治面貌:<c:if test="${requestScope.user.politicalLandscape==null||requestScope.user.politicalLandscape==''}" var="inPo">未填</c:if><c:if test="${not inPo}">${requestScope.user.politicalLandscape}</c:if></li>
                        <li>求职状态:<c:forEach items="${requestScope.jobStatuses}" var="jobstatus"><c:if test="${jobstatus.id==requestScope.user.jobStatusId}">${jobstatus.jobStatusInfo}</c:if> </c:forEach> </li>
                        <li id="li_info" style="width: 400px;height: 100px;">详细信息：${requestScope.user.introduction}</li>
                    </ul>
                </div>
            </div>
            <div id="tecnology">
                <h4 id="tecnology_titie">技能</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="tec_info">
                    <ul>
                        <c:forEach items="${requestScope.technologies}" var="technology">
                            <li>${technology.technologyLabel}</li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
            <div id="jobOri">
                <h4 id="jobOri_title">求职意向</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="jobOri_info">
                    <ul>
                        <c:forEach items="${requestScope.jobOrientations}" var="jobOrientation">
                            <li>
                                <ul class="jobOris">
                                    <li>期望职位类型：${jobOrientation.positionTypeSecond.typeName}</li>
                                    <li>期望行业类型：${jobOrientation.positionType.typeName}</li>
                                    <li>期望城市：${jobOrientation.city.province.provName}${jobOrientation.city.cityName}</li>
                                    <li>期望薪资：${jobOrientation.salary.salaryInfo}</li>
                                    <li>期望工作性质：<c:if test="${jobOrientation.workNature}" var="isWork">全职</c:if><c:if test="${not isWork}">兼职</c:if> </li>
                                </ul>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
            <div id="work_exe">
                <h4 id="work_exe_title">工作经验</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="work_exe_info">
                <ul>
                    <c:forEach items="${requestScope.workExperiences}" var="workExperience">
                        <li>
                            <ul class="work_exes">
                                <li>职称：${workExperience.name}</li>
                                <li>公司名称：${workExperience.companyName}</li>
                                <li>工作时间：<fmt:formatDate value="${workExperience.inServiceTime}" pattern="yyyy年MM月"/> -  <fmt:formatDate value="${workExperience.outServiceTime}" pattern="yyyy年MM月"/></li>
                                <li>工作描述：${workExperience.jobDescription}</li>
                            </ul>
                        </li>
                    </c:forEach>
                </ul>
                </div>
            </div>
            <div id="stu-edu">
                <h4 id="edu-title">教育和培训经历</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="edu-info">
                    <ul>
                        <c:forEach items="${requestScope.educationExperiences}" var="educationExperience">
                            <li>
                                <ul class="stu-edus">
                                    <li>学校名称：${educationExperience.schoolName}</li>
                                    <li>就读时间：<fmt:formatDate value="${educationExperience.beginTime}" pattern="yyyy年MM月"/> - <fmt:formatDate value="${educationExperience.endTime}" pattern="yyyy年MM月"/> </li>
                                    <li>经历描述：${educationExperience.introduction}</li>
                                </ul>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
            <div id="stu-cadre">
                <h4 id="cadre-title">学生干部经历</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="cadre-info">
                    <ul>
                        <c:forEach items="${requestScope.studentCadreExperiences}" var="studentCadreExperience">
                            <li>
                                <ul class="cadres">
                                    <li>干部经历：${studentCadreExperience.rankOfCadre}</li>
                                    <li>经历时间：<fmt:formatDate value="${studentCadreExperience.beginTime}" pattern="yyyy年MM月"/> -  <fmt:formatDate value="${studentCadreExperience.endTime}" pattern="yyyy年MM月"/></li>
                                    <li>经历介绍：${studentCadreExperience.introduction}</li>
                                </ul>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
            <div id="honor">
                <h4 id="honor_titie">所获荣誉</h4>
                <hr style="color: #ffd700;height: 2px;">
                <div id="honor_info">
                    <ul>
                        <c:forEach items="${requestScope.honorsWons}" var="honorsWon">
                            <li>${honorsWon.honorsWonInfo}</li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
        </div>
    </div>


    <footer>
        <div class="pxp-footer-copyright pxp-text-light">© 2021 Jobster. All Right Reserved.</div>
    </footer>
</div>

<style>
    #work_exe_info>ul>li,#cadre-info>ul>li,#edu-info>ul>li{
        margin-top: 20px;
        font-weight: bolder;
    }
    .jobOris,.work_exes,.cadres,.stu-edus{
        list-style: none;
    }
    #tecnology_titie,#jobOri_title,#work_exe_title,#edu-title,#cadre-title,#honor_titie{
        margin-top: 30px;
        font-weight: bold;
        margin-left: 20px;
    }
    #tecnology,#work_exe,#stu-edu,#stu-cadre,#honor{
        margin-top: 50px;
    }
    #yu_lan_title{
        color: #ffd700;
        font-size: 30px;
        font-family: '宋体';
    }
    #yu_lan_info{
        margin-top: 20px;
        text-align: center;
    }
    #face_pic{
        border: 5px solid #ffd700;
        border-radius: 100%;
        width: 100px;
        height: 100px;
    }
    #user_lianXi{
        /*display: flex;*/
        text-align: center;
    }
    #user_name{
        font-weight: bold;
    }
    #user_info_title{
        margin-top: 30px;
        font-weight: bold;
        margin-left: 20px;
    }
    #user_major,#tec_info,#jobOri_info,#edu-info,#cadre-info,#honor_info{
        margin-left: 20px;
    }
    #user_major>ul,#tec_info>ul,#jobOri_info>ul,.jobOris,#honor_info>ul{
        display: flex;
        flex-wrap: wrap;
    }
    #work_exe_info{
        margin-left: 20px;
    }
    .jobOris>li:nth-of-type(even),#honor_info>ul li:nth-of-type(even){
        width: 200px;
        height: 30px;
        margin-left: 150px;
        margin-bottom: 20px;
        font-weight: bolder;
    }
    .jobOris>li:nth-of-type(odd),#honor_info>ul li:nth-of-type(odd){
        width: 200px;
        height: 30px;
        margin-bottom: 20px;
        font-weight: bolder;
    }
    #user_major>ul li:nth-of-type(even),#tec_info>ul li:nth-of-type(even){
        width: 300px;
        height: 30px;
        margin-left: 100px;
        margin-bottom: 20px;
        font-weight: bolder;
    }
    #user_major>ul li:nth-of-type(odd),#tec_info>ul li:nth-of-type(odd),#honor_info>ul li:nth-of-type(odd){
        width: 200px;
        height: 30px;
        margin-bottom: 20px;
        font-weight: bolder;
    }
    /*#user_major>ul li:nth-of-type(odd){*/
    /*    font-weight: bolder;*/
    /*}*/
    #user_major>ul li::marker,#tec_info>ul li::marker,#jobOri_info>ul>li::marker,#work_exe_info>ul>li::marker,#edu-info>ul>li::marker,#cadre-info>ul>li::marker,#honor_info>ul>li::marker{
        color: #ffd700;
    }
</style>
<script src="/static/web/js/jquery-3.4.1.min.js"></script>
<script src="/static/web/js/bootstrap.bundle.min.js"></script>
<script src="/static/web/js/owl.carousel.min.js"></script>
<script src="/static/web/js/nav.js"></script>
<script src="/static/web/js/Chart.min.js"></script>
<script src="/static/web/js/main.js"></script>

<script type="text/javascript">
    $(function (){
        init();
        $("#addTec").click(addTec);
        $("#exist_tec").on("click",".delTec",function (){
            if (confirm("确认要删除这个技能标签吗？")) {
                let id = $(this).data("id");
                $.ajax({
                   url:"/web/personal/delOneTec",
                    type:"get",
                    data:{
                        id:id
                    },
                    success:function (mes)
                    {
                        $(this).parent().remove();
                    }.bind(this)
                });
            }
        });
        $("#pxp-candidate-work-type").click(changePositionTypeSecond);
        $("#addInfo").click(addInfo);
        $(".weight").on("click","#addExp",addExperience);
        $(".exp").on("click",".updateExp",updateExp);
        $(".exp").on("click",".delExp",delExp);
        $(".weight").on("click","#updateExp",updateOneExp);
        $(".might").on("click","#addEdu",addEdu);
        $(".edu").on("click",".updateEdu",updateEdu);
        $(".edu").on("click",".delEdu",delEdu);
        $(".might").on("click","#updateEdu",updateOneEdu);
        $(".kight").on("click","#addCad",addCad);
        $(".cad").on("click",".updateCad",updateCad);
        $(".cad").on("click",".delCad",delCad);
        $(".kight").on("click","#updateCad",updateOneCad);
        $(".height").on("click","#addOri",addOri);
        $(".ori").on("click",".updateOri",updateOri);
        $(".ori").on("click",".delOri",delOri);
        $(".height").on("click","#updateOri",updateOneOri);
        $("#addHor").click(addHor);
        $("#exist_hor").on("click",".delHor",function (){
            if (confirm("确认要删除这个技能标签吗？")) {
                let id = $(this).data("id");
                $.get("/web/personal/delOneHor",{id:id},function (mes){
                    $("#hor_msg").html("删除成功");
                    $(this).parent().remove();
                }.bind(this));

            }
        });
        $("#stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".exp").css("display","none");
                $(".exp-input").css("display","none");
                $(".exp-row").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".exp").css("display","block");
                $(".exp-input").css("display","block");
                $(".exp-row").css("display","flex");
            }
        });
        $("#set_stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".set-flex").css("display","none");

            }
            else{
                $(this).html("收 起");
                $(".set-flex").css("display","flex");
            }
        });
        $("#ji-stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".essential-information").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".essential-information").css("display","block");
            }
        });
        $("#tec_stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".tec-row").css("display","none");
                $(".tec-flex").css("display","none");
                $("#tec_msg").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".tec-row").css("display","block");
                $(".tec-flex").css("display","flex");
                $("#tec_msg").css("display","block");
            }
        });
        $("#hor_stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".hor-row").css("display","none");
                $(".hor-flex").css("display","none");
                $("#hor_msg").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".hor-row").css("display","block");
                $(".hor-flex").css("display","flex");
                $("#hor_msg").css("display","block");
            }
        });
        $("#edu-stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".edu").css("display","none");
                $(".edu-input").css("display","none");
                $(".edu-row").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".edu").css("display","table");
                $(".edu-input").css("display","block");
                $(".edu-row").css("display","flex");
            }
        });
        $("#cad-stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".cad").css("display","none");
                $(".cad-input").css("display","none");
                $(".cad-row").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".cad").css("display","table");
                $(".cad-input").css("display","block");
                $(".cad-row").css("display","flex");
            }
        });
        $("#ori-stow").click(function (){
            if ($(this).html()=="收 起")
            {
                $(this).html("展 开");
                $(".ori").css("display","none");
                $(".ori-input").css("display","none");
                $(".ori-row").css("display","none");
            }
            else{
                $(this).html("收 起");
                $(".ori").css("display","table");
                $(".ori-input").css("display","block");
                $(".ori-row").css("display","flex");
            }
        });
        $("#pxp-candidate-ori-prov").click(changeCity);
        $("#pxp-candidate-ori-position-type").click(changePositionTypeSecondOri);
    });

    function addInfo()
    {
        if (checkName()&&checkSex()&&checkBirth()&&checkEmail()&&checkPhone()&&checkQQ()&&checkSchool()&&checkMajor()&&checkPhoto()&&checkMajor()&&checkNation()&&checkNow()&&checkNative()&&checkInfo()&&checkPoli()&&checkMarry()&&checkStatus())
        {
            let formData = new FormData();
            formData.append("name",$("#pxp-candidate-name").val());
            formData.append("sex",$("#pxp-candidate-sex").val());
            formData.append("birthday",$("#pxp-candidate-birth").val());
            formData.append("email",$("#pxp-candidate-email").val());
            formData.append("phone",$("#pxp-candidate-phone").val());
            formData.append("school",$("#pxp-candidate-school").val());
            formData.append("introduction",$("#pxp-candidate-about").val());
            formData.append("jobStatusId",$("#pxp-candidate-excepted-status").val());
            if ($("#pxp-candidate-qq").val()!=""&&$("#pxp-candidate-qq").val()!=null)
            {
                formData.append("qq",$("#pxp-candidate-qq").val());
            }
            if ($("#pxp-candidate-major").val()!=""&&$("#pxp-candidate-major").val()!=null)
            {
                formData.append("major",$("#pxp-candidate-major").val());
            }
            if ($("#pxp-candidate-photo-choose-file").val()!=""&&$("#pxp-candidate-photo-choose-file").val()!=null)
            {
                formData.append("facePic",$("#pxp-candidate-photo-choose-file")[0].files[0]);
            }
            if ($("#pxp-candidate-national").val()!=""&&$("#pxp-candidate-national").val()!=null)
            {
                formData.append("national",$("#pxp-candidate-national").val());
            }
            if ($("#pxp-candidate-now").val()!=""&&$("#pxp-candidate-now").val()!=null)
            {
                formData.append("nowIn",$("#pxp-candidate-now").val());
            }
            if ($("#pxp-candidate-place").val()!=""&&$("#pxp-candidate-place").val()!=null)
            {
                formData.append("nativePlace",$("#pxp-candidate-place").val());
            }
            if ($("#pxp-candidate-excepted-pol").val()!=""&&$("#pxp-candidate-excepted-pol").val()!=null)
            {
                formData.append("politicalLandscape",$("#pxp-candidate-excepted-pol").val());
            }
            if ($("#pxp-candidate-marry").val()!=""&&$("#pxp-candidate-marry").val()!=null)
            {
                formData.append("marriage",$("#pxp-candidate-marry").val());
            }
            $.ajax({
                url:"/web/personal/insertProfile",
                type:"post",
                data:formData,
                processData:false,
                contentType:false,
                success:function (mes)
                {
                    alert("保存成功");
                    if (mes!="null")
                    {
                        $("#faceHead").css("background-image","url(/static/uploadImages/"+mes+")");
                    }
                }
            });
        }

    }

    var oriIsUpdating=0;

    function updateOneOri()
    {
        if (checkOriName()) {
            let id = $(this).data("id");
            var positionTypeId = $("#pxp-candidate-ori-position-type").val();
            var positionType = $("#pxp-candidate-ori-position-type").find("option:selected").html();
            var positionTypeSecondId = $("#pxp-candidate-ori-position-type-second").val();
            var positionTypeSecond = $("#pxp-candidate-ori-position-type-second").find("option:selected").html();
            var provName = $("#pxp-candidate-ori-prov").find("option:selected").html();
            var cityId = $("#pxp-candidate-ori-city").val();
            var cityName = $("#pxp-candidate-ori-city").find("option:selected").html();
            var salaryId = $("#pxp-candidate-ori-salary").val();
            var salary = $("#pxp-candidate-ori-salary").find("option:selected").html();
            var workNatureVal = $("#pxp-candidate-ori-work-nature").val();
            if (workNatureVal=="true")
            {
                var workNature = "全职";
            }
            else
            {
                var workNature = "兼职";
            }
            $.ajax({
               url:"/web/personal/updateOneOri",
                type:"post",
                data:{
                   id:id,
                   positionTypeId:positionTypeId,
                    positionTypeSecondId:positionTypeSecondId,
                    exceptedCityId:cityId,
                    exceptedSalaryId: salaryId,
                    workNature:workNatureVal
                },
                success:function (mes)
                {
                    $(".ori").find("tr").each(function () {
                        if ($(this).attr("style") == "color: red;") {
                            $(this).find(".pxp-candidate-dashboard-ori-position-type-second").html(positionTypeSecond);
                            $(this).find(".pxp-candidate-dashboard-ori-position-type-second").data("val",positionTypeSecondId);
                            $(this).find(".pxp-candidate-dashboard-ori-position-type").html(positionType);
                            $(this).find(".pxp-candidate-dashboard-ori-position-type").data("val",positionTypeId);
                            $(this).find(".pxp-candidate-dashboard-ori-city").html(provName+cityName);
                            $(this).find(".pxp-candidate-dashboard-ori-city").data("val",cityId);
                            $(this).find(".pxp-candidate-dashboard-ori-salary").html(salary);
                            $(this).find(".pxp-candidate-dashboard-ori-salary").data("val",salaryId);
                            $(this).find(".pxp-candidate-dashboard-ori-work-nature").html(workNature);
                            $(this).find(".pxp-candidate-dashboard-ori-work-nature").data("val",workNatureVal);
                        }
                    });
                    $(".ori").find("tr").css("color", "black");
                    $("#pxp-candidate-ori-position-type").val("0");
                    $("#pxp-candidate-ori-position-type-second").html("<option value='0' hidden disabled selected>请先选择期望行业</option>");
                    $("#pxp-candidate-ori-prov").val("0");
                    $("#pxp-candidate-ori-city").html("<option value='0' hidden disabled selected>请先选择期望行业</option>");
                    $("#pxp-candidate-ori-salary").val("0");
                    $("#pxp-candidate-ori-work-nature").val("true");
                    $("#updateOri").remove();
                    $(".height").append("<button class='btn rounded-pill pxp-subsection-cta ori-input' id='addOri' type='button'>新增工作意向</button>");
                    oriIsUpdating = 0;
                    $("#ori_msg").html("修改成功");
                }
            });
        }
    }

    //删除一个工作意向
    function delOri()
    {
        if (oriIsUpdating==1)
        {
            $("#ori_msg").html("现在正在修改信息，完成修改后再进行删除操作");
            return;
        }
        if (confirm("确认要删除这条经历吗？")) {
            let id = $(this).data("id");
            $.get("/web/personal/delOneOri",{id:id},function (mes) {
                $(this).parent().parent().parent().parent().parent().remove();
            }.bind(this))
        }
    }
    //点击修改拉下去
    function updateOri()
    {
        let id = $(this).data("id");
        if (oriIsUpdating==0) {
            $("#addOri").remove();
            $(".height").append("<button class='btn rounded-pill pxp-subsection-cta ori-input' id='updateOri' type='button' data-id='"+id+"'>更改工作意向</button>");
            oriIsUpdating=1;
        }
        if ($(this).parent().parent().parent().parent().parent().css("color")!="rgb(255, 0, 0)") {
            $("#updateOri").data("id",id);
            $(".ori").find("tr").css("color", "black");
            $(this).parent().parent().parent().parent().parent().css("color", "red");
            $("#pxp-candidate-ori-position-type").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-ori-position-type").data("val"));
            changePositionTypeSecondOri();
            $("#pxp-candidate-ori-position-type-second").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-ori-position-type-second").data("val"));
            let cityId = $(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-ori-city").data("val");
            $.ajax({
                url:"/web/personal/getProvByCityId",
                type:"get",
                data:{
                    cityId:cityId
                },
                async:false,
                success:function (mes){
                    $("#pxp-candidate-ori-prov").val(mes);
                }
            });
            changeCity();
            $("#pxp-candidate-ori-city").val(cityId);
            $("#pxp-candidate-ori-salary").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-ori-salary").data("val"));
            $("#pxp-candidate-ori-work-nature").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-ori-work-nature").data("val")+"");
        }
        else {
            $(".ori").find("tr").css("color", "black");
            $("#pxp-candidate-ori-position-type").val("0");
            $("#pxp-candidate-ori-position-type-second").html("<option value='0' hidden disabled selected>请先选择期望行业</option>");
            $("#pxp-candidate-ori-prov").val("0");
            $("#pxp-candidate-ori-city").html("<option value='0' hidden disabled selected>请先选择期望行业</option>");
            $("#pxp-candidate-ori-salary").val("0");
            $("#pxp-candidate-ori-work-nature").val("true");
            $("#updateOri").remove();
            $(".height").append("<button class='btn rounded-pill pxp-subsection-cta ori-input' id='addOri' type='button'>新增工作意向</button>");
            oriIsUpdating=0;
        }
        return false;
    }

    //工作意向表单验证
    function checkOriName()
    {
        var positionTypeId = $("#pxp-candidate-ori-position-type").val();
        if (positionTypeId==null)
        {
            $("#ori_msg").html("请选择期望行业");
            $("#pxp-candidate-ori-position-type").focus();
            return false;
        }
        var positionTypeSecondId = $("#pxp-candidate-ori-position-type-second").val();
        if (positionTypeSecondId==null)
        {
            $("#ori_msg").html("请选择期望类型");
            $("#pxp-candidate-ori-position-type-second").focus();
            return false;
        }
        let cityId = $("#pxp-candidate-ori-city").val();
        if (cityId==null)
        {
            $("#ori_msg").html("请选择期望的城市");
            $("#pxp-candidate-ori-city").focus();
            return false;
        }
        let salaryId = $("#pxp-candidate-ori-salary").val();
        if(salaryId==null)
        {
            $("#ori_msg").html("请选择期望的薪资范围");
            $("#pxp-candidate-ori-salary").focus();
            return false;
        }

        return true;
    }
    //添加工作意向
    function addOri()
    {
        if($(".ori").find("tr").length>=5)
        {
            $("#ori_msg").html("最多录入五条工作意向");
            return;
        }
        if(checkOriName()) {
            var positionTypeId = $("#pxp-candidate-ori-position-type").val();
            var positionType = $("#pxp-candidate-ori-position-type").find("option:selected").html();
            var positionTypeSecondId = $("#pxp-candidate-ori-position-type-second").val();
            var positionTypeSecond = $("#pxp-candidate-ori-position-type-second").find("option:selected").html();
            var provName = $("#pxp-candidate-ori-prov").find("option:selected").html();
            var cityId = $("#pxp-candidate-ori-city").val();
            var cityName = $("#pxp-candidate-ori-city").find("option:selected").html();
            var salaryId = $("#pxp-candidate-ori-salary").val();
            var salary = $("#pxp-candidate-ori-salary").find("option:selected").html();
            var workNatureVal = $("#pxp-candidate-ori-work-nature").val();
            if (workNatureVal=="true")
            {
                var workNature = "全职";
            }
            else
            {
                var workNature = "兼职";
            }

            $.ajax({
               url:"/web/personal/addOri",
               type:"post",
               data:{
                   positionTypeId:positionTypeId,
                   positionTypeSecondId:positionTypeSecondId,
                   exceptedCityId:cityId,
                   exceptedSalaryId:salaryId,
                   workNature:workNatureVal
               },
                success:function (mes)
                {
                    var trObj = $("<tr></tr>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-ori-position-type-second' data-val='"+positionTypeSecondId+"'>" + positionTypeSecond + "</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-ori-position-type' data-val='"+positionTypeId+"'>" + positionType + "</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-ori-city' data-val='"+cityId+"'>" + provName+cityName + "</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-ori-salary' data-val='"+salaryId+"'>" +salary+ "</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-ori-work-nature' data-val='"+workNatureVal+"'>" + workNature + "</div></td>");
                    trObj.append("<td><div class='pxp-dashboard-table-options'><ul class='list-unstyled'><li><button title='修改' type='button' class='updateOri' data-id='"+mes+"'><span class='fa fa-pencil'></span></button></li> <li><button title='删除' type='button' class='delOri' data-id='"+mes+"'><span class='fa fa-trash-o'></span></button></li></ul></div></td>")

                    $(".ori").append(trObj);
                    $("#ori_msg").html("添加成功");
                    $("#pxp-candidate-ori-position-type").val("0");
                    $("#pxp-candidate-ori-position-type-second").html("<option value='0' hidden disabled selected>请先选择期望行业</option>");
                    $("#pxp-candidate-ori-prov").val("0");
                    $("#pxp-candidate-ori-city").html("<option value='0' selected hidden disabled>请先选择省份</option>");
                    $("#pxp-candidate-ori-salary").val("0");
                    $("#pxp-candidate-ori-work-nature").val("true");
                }
            });
        }
        return false;
    }

    function changeCity()
    {
        let provId = $("#pxp-candidate-ori-prov").val();
        $.ajax({
            url:"/web/personal/changeCity",
            type: "post",
            async: false,
            data: {
                provId:provId
            },
            dataType: "json",
            success:function (mes){
                $("#pxp-candidate-ori-city").html("");
                for (let i = 0; i < mes.length; i++) {
                    $("#pxp-candidate-ori-city").append("<option value='"+mes[i].cityId+"'>"+mes[i].cityName+"</option>");
                }
            }
        });
    }

    function changePositionTypeSecondOri()
    {
        let positionTypeId = $("#pxp-candidate-ori-position-type").val();
        $.ajax({
            url:"/web/personal/changePositionTypeSecond",
            type:"post",
            data:{
                positionTypeId:positionTypeId
            },
            dataType:"json",
            async:false,
            success:function (mes){
                $("#pxp-candidate-ori-position-type-second").html("");
                for (let i = 0; i < mes.length; i++) {
                    $("#pxp-candidate-ori-position-type-second").append("<option value='"+mes[i].id+"'>"+mes[i].typeName+"</option>");
                }
            }
        });
    }

    function addHor()
    {
        let horInfo = $("#hor").val();
        if (horInfo=="")
        {
            $("#hor_msg").html("请输入文字后再进行添加");
            return false;
        }
        let zheng = /^.{2,20}$/;
        if (zheng.test(horInfo)) {
            if ($("#exist_hor").find("li").length<6) {
                let exist = 0;
                $("#exist_hor").find("[class='label']").each(function (){
                    if ($(this).html()==horInfo)
                    {
                        exist = 1;
                        return;
                    }
                });
                if (exist==0) {
                    $.ajax({
                        url:"/web/personal/addHor",
                        type:"post",
                        data:{
                            honorsWonInfo:horInfo
                        },
                        success:function (mes)
                        {
                            $("#hor_msg").html("添加成功");
                            $("#hor").val("");
                            $("#exist_hor").append("<li><span class='label'>" + horInfo + "</span><span class='fa fa-trash-o delHor' data-id='"+mes+"'></span></li>");
                        }
                    });

                }
                else {
                    $("#hor_msg").html("你已经存在这个标签了");
                }
            }
            else
            {
                $("#hor_msg").html("最多添加6个");
            }

        }
        else
        {
            $("#hor_msg").html("内容格式有误");
        }

        return false;
    }

    var cadIsUpdating = 0;
    function updateOneCad()
    {
        if (checkCadName()) {
            let id = $(this).data("id");
            var rankOfCadre = $("#pxp-candidate-cad-rank").val();
            var beginTime = $("#pxp-candidate-cad-begin").val();
            var ins = beginTime.split("-");
            var beginTimeFmt = ins[0] + "年" + ins[1] + "月";
            var endTime = $("#pxp-candidate-cad-end").val();
            var outs = endTime.split("-");
            var endTimeFmt = outs[0] + "年" + outs[1] + "月";
            var introduction = $("#pxp-candidate-cad-about").val();
            $.ajax({
                url:"/web/personal/updateOneCad",
                type:"post",
                data:{
                    id:id,
                    rankOfCadre:rankOfCadre,
                    beginTime:beginTime,
                    endTime:endTime,
                    introduction:introduction
                },
                success:function (mes)
                {
                    $(".cad").find("tr").each(function () {
                        if ($(this).attr("style") == "color: red;") {
                            $(this).find(".pxp-candidate-dashboard-cadre-rank").html(rankOfCadre);
                            $(this).find(".pxp-candidate-dashboard-cadre-about").html(introduction);
                            $(this).find(".pxp-candidate-dashboard-cadre-time").html(beginTimeFmt + " - " + endTimeFmt);
                            $(this).find(".pxp-candidate-dashboard-cadre-time").data("begin",beginTime);
                            $(this).find(".pxp-candidate-dashboard-cadre-time").data("end",endTime);
                        }
                    });
                    $(".cad").find("tr").css("color", "black");
                    $("#pxp-candidate-cad-rank").val("");
                    $("#pxp-candidate-cad-begin").val("");
                    $("#pxp-candidate-cad-end").val("");
                    $("#pxp-candidate-cad-about").val("");
                    $("#updateCad").remove();
                    $(".kight").append("<button class='btn rounded-pill pxp-subsection-cta cad-input' id='addCad' type='button'>新增学生干部经历</button>");
                    cadIsUpdating = 0;
                    $("#cad_msg").html("修改成功");
                }
            });

        }
    }

    function delCad()
    {
        if (cadIsUpdating==1)
        {
            $("#cad_msg").html("现在正在修改信息，完成修改后再进行删除操作");
            return;
        }
        if (confirm("确认要删除这条经历吗？")) {
            let id = $(this).data("id");
            $.get("/web/personal/delOneCad",{id:id},function (mes){
                $("#cad_msg").html("删除成功");
                $(this).parent().parent().parent().parent().parent().remove();
            }.bind(this));

        }
    }

    function updateCad()
    {
        let id = $(this).data("id");
        if (cadIsUpdating==0) {
            $("#addCad").remove();
            $(".kight").append("<button class='btn rounded-pill pxp-subsection-cta cad-input' id='updateCad' type='button' data-id='"+id+"'>更改学生干部经历</button>");
            cadIsUpdating=1;
        }
        if ($(this).parent().parent().parent().parent().parent().css("color")!="rgb(255, 0, 0)") {
            $("#updateCad").data("id",id);
            $(".cad").find("tr").css("color", "black");
            $(this).parent().parent().parent().parent().parent().css("color", "red");
            $("#pxp-candidate-cad-about").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-cadre-about").html());
            $("#pxp-candidate-cad-rank").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-cadre-rank").html());
            $("#pxp-candidate-cad-begin").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-cadre-time").data("begin"));
            $("#pxp-candidate-cad-end").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-cadre-time").data("end"));
        }
        else {
            $(".cad").find("tr").css("color", "black");
            $("#pxp-candidate-cad-rank").val("");
            $("#pxp-candidate-cad-about").val("");
            $("#pxp-candidate-cad-begin").val("");
            $("#pxp-candidate-cad-end").val("");
            $("#updateCad").remove();
            $(".kight").append("<button class='btn rounded-pill pxp-subsection-cta cad-input' id='addCad' type='button'>新增学生干部经历</button>");
            cadIsUpdating=0;
        }
        return false;
    }
    function checkCadName()
    {
        var rankOfCadre = $("#pxp-candidate-cad-rank").val();
        if (rankOfCadre=="")
        {
            $("#cad_msg").html("干部名称不能为空");
            $("#pxp-candidate-cad-rank").focus();
            return false;
        }
        let rankZheng = /^.{3,30}$/;
        if (!rankZheng.test(rankOfCadre))
        {
            $("#cad_msg").html("学校名称格式有误");
            $("#pxp-candidate-cad-rank").focus();
            return false;
        }
        var beginTime = $("#pxp-candidate-cad-begin").val();
        var endTime = $("#pxp-candidate-cad-end").val();
        if (beginTime>=endTime)
        {
            $("#cad_msg").html("时间填写有误");
            $("#pxp-candidate-cad-begin").focus();
            return false;
        }
        var introduce = $("#pxp-candidate-cad-about").val();
        if (introduce=="")
        {
            $("#cad_msg").html("请简单描述一下干部经历");
            $("#pxp-candidate-cad-about").focus();
            return false;
        }
        let introduceZheng = /^.{5,2000}$/
        if (!introduceZheng.test(introduce))
        {
            $("#ead_msg").html("描述格式有误");
            $("#pxp-candidate-cad-about").focus();
            return false;
        }
        return true;
    }
    function addCad()
    {
        if($(".cad").find("tr").length>=5)
        {
            $("#cad_msg").html("最多录入五条教育经历");
            return;
        }
        if(checkCadName()) {
            var rankOfCadre = $("#pxp-candidate-cad-rank").val();
            var beginTime = $("#pxp-candidate-cad-begin").val();
            var bTimes = beginTime.split("-");
            var beginTimeFmt = bTimes[0] + "年" + bTimes[1] + "月";
            var endTime = $("#pxp-candidate-cad-end").val();
            var eTimes = endTime.split("-");
            var endTimeFmt = eTimes[0] + "年" + eTimes[1] + "月";
            var introduction = $("#pxp-candidate-cad-about").val();
            $.ajax({
                url:"/web/personal/addCad",
                type:"post",
                data:{
                    rankOfCadre:rankOfCadre,
                    beginTime:beginTime,
                    endTime:endTime,
                    introduction:introduction
                },
                success:function (mes)
                {
                    var trObj = $("<tr></tr>");
                    trObj.append("<td style='width: 30%;'><div class='pxp-candidate-dashboard-cadre-rank'>" + rankOfCadre + "</div></td>");
                    trObj.append("<td style='width: 25%;'><div class='pxp-candidate-dashboard-cadre-about'>" + introduction + "</div></td>");
                    trObj.append("<td style='width: 25%;'><div class='pxp-candidate-dashboard-cadre-time' data-begin='"+beginTime+"' data-end='"+endTime+"'>" + beginTimeFmt + " - " + endTimeFmt + "</div></td>");
                    trObj.append("<td><div class='pxp-dashboard-table-options'><ul class='list-unstyled'><li><button title='修改' type='button' class='updateCad' data-id='"+mes+"'><span class='fa fa-pencil'></span></button></li> <li><button title='删除' type='button' class='delCad' data-id='"+mes+"'><span class='fa fa-trash-o'></span></button></li></ul></div></td>");
                    $(".cad").append(trObj);
                    $("#cad_msg").html("添加成功");
                    $("#pxp-candidate-cad-rank").val("");
                    $("#pxp-candidate-cad-about").val("");
                    $("#pxp-candidate-cad-begin").val("");
                    $("#pxp-candidate-cad-end").val("");
                }
            });

        }
        return false;
    }

    var eduIsUpdating = 0;
    function updateOneEdu()
    {
        if (checkEduName()) {
            let id = $(this).data("id");
            var schoolName = $("#pxp-candidate-edu-school").val();
            var beginTime = $("#pxp-candidate-edu-begin").val();
            var ins = beginTime.split("-");
            var beginTimeFmt = ins[0] + "年" + ins[1] + "月";
            var endTime = $("#pxp-candidate-edu-end").val();
            var outs = endTime.split("-");
            var endTimeFmt = outs[0] + "年" + outs[1] + "月";
            var introduction = $("#pxp-candidate-edu-about").val();
            $.ajax({
                url:"/web/personal/updateOneEdu",
                type:"post",
                data:{
                    id:id,
                    schoolName:schoolName,
                    beginTime:beginTime,
                    endTime:endTime,
                    introduction:introduction
                },
                success:function (mes)
                {
                    $(".edu").find("tr").each(function () {
                        if ($(this).attr("style") == "color: red;") {
                            $(this).find(".pxp-candidate-dashboard-experience-title").html(schoolName);
                            $(this).find(".pxp-candidate-dashboard-experience-school").html(introduction);
                            $(this).find(".pxp-candidate-dashboard-experience-time").html(beginTimeFmt + " - " + endTimeFmt);
                            $(this).find(".pxp-candidate-dashboard-experience-time").data("begin",beginTime);
                            $(this).find(".pxp-candidate-dashboard-experience-time").data("end",endTime);
                        }
                    });
                    $(".edu").find("tr").css("color", "black");
                    $("#pxp-candidate-edu-school").val("");
                    $("#pxp-candidate-edu-begin").val("");
                    $("#pxp-candidate-edu-end").val("");
                    $("#pxp-candidate-edu-about").val("");
                    $("#updateEdu").remove();
                    $(".might").append("<button class='btn rounded-pill pxp-subsection-cta edu-input' id='addEdu' type='button'>新增教育经历</button>");
                    eduIsUpdating = 0;
                    $("#edu_msg").html("修改成功");
                }
            });

        }
    }

    function delEdu()
    {
        if (eduIsUpdating==1)
        {
            $("#edu_msg").html("现在正在修改信息，完成修改后再进行删除操作");
            return;
        }
        if (confirm("确认要删除这条经历吗？")) {
            let id = $(this).data("id");
            $.get("/web/personal/delOneEdu",{id:id},function (mes){
                $("#edu_msg").html("删除成功");
                $(this).parent().parent().parent().parent().parent().remove();
            }.bind(this));

        }
    }
    //修改教育经历
    function updateEdu()
    {
        let id = $(this).data("id");
        if (eduIsUpdating==0) {
            $("#addEdu").remove();
            $(".might").append("<button class='btn rounded-pill pxp-subsection-cta edu-input' id='updateEdu' type='button' data-id='"+id+"'>更改教育经历</button>");
            eduIsUpdating=1;
        }
        if ($(this).parent().parent().parent().parent().parent().css("color")!="rgb(255, 0, 0)") {
            $("#updateEdu").data("id",id);
            $(".edu").find("tr").css("color", "black");
            $(this).parent().parent().parent().parent().parent().css("color", "red");
            $("#pxp-candidate-edu-about").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-school").html());
            $("#pxp-candidate-edu-school").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-title").html());
            $("#pxp-candidate-edu-begin").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-time").data("begin"));
            $("#pxp-candidate-edu-end").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-time").data("end"));
        }
        else {
            $(".edu").find("tr").css("color", "black");
            $("#pxp-candidate-edu-about").val("");
            $("#pxp-candidate-edu-school").val("");
            $("#pxp-candidate-edu-begin").val("");
            $("#pxp-candidate-edu-end").val("");
            $("#updateEdu").remove();
            $(".might").append("<button class='btn rounded-pill pxp-subsection-cta edu-input' id='addEdu' type='button'>新增教育经历</button>");
            eduIsUpdating=0;
        }

        return false;
    }

    function checkEduName()
    {
        var schoolName = $("#pxp-candidate-edu-school").val();
        if (schoolName=="")
        {
            $("#edu_msg").html("学校名称不能为空");
            $("#pxp-candidate-edu-school").focus();
            return false;
        }
        let nameZheng = /^.{3,30}$/;
        if (!nameZheng.test(schoolName))
        {
            $("#edu_msg").html("学校名称格式有误");
            $("#pxp-candidate-edu-school").focus();
            return false;
        }
        var beginTime = $("#pxp-candidate-edu-begin").val();
        var endTime = $("#pxp-candidate-edu-end").val();
        if (beginTime>=endTime)
        {
            $("#edu_msg").html("时间填写有误");
            $("#pxp-candidate-edu-begin").focus();
            return false;
        }
        var introduce = $("#pxp-candidate-edu-about").val();
        if (introduce=="")
        {
            $("#edu_msg").html("请简单描述一下在校学习情况");
            $("#pxp-candidate-edu-about").focus();
            return false;
        }
        let introduceZheng = /^.{5,2000}$/
        if (!introduceZheng.test(introduce))
        {
            $("#edu_msg").html("描述格式有误");
            $("#pxp-candidate-edu-about").focus();
            return false;
        }
        return true;
    }

    //添加教育经历
    function addEdu()
    {
        if($(".edu").find("tr").length>=5)
        {
            $("#edu_msg").html("最多录入五条教育经历");
            return;
        }
        if(checkEduName()) {
            var schoolName = $("#pxp-candidate-edu-school").val();
            var beginTime = $("#pxp-candidate-edu-begin").val();
            var bTimes = beginTime.split("-");
            var beginTimeFmt = bTimes[0] + "年" + bTimes[1] + "月";
            var endTime = $("#pxp-candidate-edu-end").val();
            var eTimes = endTime.split("-");
            var endTimeFmt = eTimes[0] + "年" + eTimes[1] + "月";
            var introduction = $("#pxp-candidate-edu-about").val();
            $.ajax({
                url:"/web/personal/addEdu",
                type:"post",
                data:{
                    schoolName:schoolName,
                    beginTime:beginTime,
                    endTime:endTime,
                    introduction:introduction
                },
                success:function (mes)
                {
                    var trObj = $("<tr></tr>");
                    trObj.append("<td style='width: 30%;'><div class='pxp-candidate-dashboard-experience-title'>" + schoolName + "</div></td>");
                    trObj.append("<td style='width: 25%;'><div class='pxp-candidate-dashboard-experience-school'>" + introduction + "</div></td>");
                    trObj.append("<td style='width: 25%;'><div class='pxp-candidate-dashboard-experience-time' data-begin='"+beginTime+"' data-end='"+endTime+"'>" + beginTimeFmt + " - " + endTimeFmt + "</div></td>");
                    trObj.append("<td><div class='pxp-dashboard-table-options'><ul class='list-unstyled'><li><button title='修改' type='button' class='updateEdu' data-id='"+mes+"'><span class='fa fa-pencil'></span></button></li> <li><button title='删除' type='button' class='delEdu' data-id='"+mes+"'><span class='fa fa-trash-o'></span></button></li></ul></div></td>")
                    $(".edu").append(trObj);
                    $("#edu_msg").html("添加成功");
                    $("#pxp-candidate-edu-school").val("");
                    $("#pxp-candidate-edu-begin").val("");
                    $("#pxp-candidate-edu-end").val("");
                    $("#pxp-candidate-edu-about").val("");
                }
            });

        }
        return false;

    }


    function checkExpName()
    {
        var name = $("#pxp-candidate-work-title").val();
        if (name=="")
        {
            $("#exp_msg").html("职位名称不能为空");
            $("#pxp-candidate-work-title").focus();
            return false;
        }
        let nameZheng = /^.{3,30}$/;
        if (!nameZheng.test(name))
        {
            $("#exp_msg").html("职位名称格式有误");
            $("#pxp-candidate-work-title").focus();
            return false;
        }
        var companyName = $("#pxp-candidate-work-company").val();
        if (companyName=="")
        {
            $("#exp_msg").html("公司名称不能为空");
            $("#pxp-candidate-work-company").focus();
            return false;
        }
        let companyNameZheng = /^.{3,50}$/;
        if (!companyNameZheng.test(companyName))
        {
            $("#exp_msg").html("公司名称格式有误");
            $("#pxp-candidate-work-company").focus();
            return false;
        }
        var inServiceTime = $("#pxp-candidate-work-time").val();
        var outServiceTime = $("#pxp-candidate-work-endTime").val();
        if (inServiceTime>=outServiceTime)
        {
            $("#exp_msg").html("时间填写有误");
            $("#pxp-candidate-work-time").focus();
            return false;
        }
        var introduce = $("#pxp-candidate-work-about").val();
        if (introduce=="")
        {
            $("#exp_msg").html("请简单描述一下离职原因");
            $("#pxp-candidate-work-about").focus();
            return false;
        }
        let introduceZheng = /^.{5,2000}$/
        if (!introduceZheng.test(introduce))
        {
            $("#exp_msg").html("描述格式有误");
            $("#pxp-candidate-work-about").focus();
            return false;
        }
        return true;
    }
    var expIsUpdating = 0;

    function updateOneExp()
    {
        if (checkExpName()) {
            var name = $("#pxp-candidate-work-title").val();
            var companyName = $("#pxp-candidate-work-company").val();
            var inServiceTime = $("#pxp-candidate-work-time").val();
            var ins = inServiceTime.split("-");
            var inServiceTimeFmt = ins[0] + "年" + ins[1] + "月";
            var outServiceTime = $("#pxp-candidate-work-endTime").val();
            var outs = outServiceTime.split("-");
            var outServiceTimeFmt = outs[0] + "年" + outs[1] + "月";
            var introduction = $("#pxp-candidate-work-about").val();
            var positionTypeSecondId = $("#pxp-candidate-work-type-second").val();
            let id = $(this).data("id");
            $.ajax({
                url:"/web/personal/updateOneExp",
                type:"post",
                data:{
                    name:name,
                    id:id,
                    companyName:companyName,
                    inServiceTime:inServiceTime,
                    outServiceTime:outServiceTime,
                    jobDescription: introduction,
                    positionTypeSecondId:positionTypeSecondId
                },
                success:function (mes)
                {
                    $(".exp").find("tr").each(function () {
                        if ($(this).attr("style") == "color: red;") {
                            $(this).find(".pxp-candidate-dashboard-experience-title").html(name);
                            $(this).find(".pxp-candidate-dashboard-experience-company").html(companyName);
                            $(this).find(".pxp-candidate-dashboard-experience-time").html(inServiceTimeFmt + " - " + outServiceTimeFmt);
                            $(this).find(".pxp-candidate-dashboard-experience-introduction").html(introduction);
                            $(this).find(".pxp-candidate-dashboard-experience-time").data("in",inServiceTime);
                            $(this).find(".pxp-candidate-dashboard-experience-time").data("out",outServiceTime);
                            $(this).find(".pxp-candidate-dashboard-experience-introduction").data("position",positionTypeSecondId);
                        }
                    });
                    $(".exp").find("tr").css("color", "black");
                    $("#pxp-candidate-work-title").val("");
                    $("#pxp-candidate-work-company").val("");
                    $("#pxp-candidate-work-time").val("");
                    $("#pxp-candidate-work-endTime").val("");
                    $("#pxp-candidate-work-about").val("");
                    positionTypeSecondId = 1;
                    $.get("/web/personal/getPositionTypeIdBySecond", {positionTypeSecondId: positionTypeSecondId}, function (mes) {
                        $("#pxp-candidate-work-type").find("option[value='" + mes + "']").prop("selected", true);
                        changePositionTypeSecond();
                        $("#pxp-candidate-work-type-second").find("option[value='" + positionTypeSecondId + "']").prop("selected", true);
                    });
                    $("#updateExp").remove();
                    $(".weight").append("<button class='btn rounded-pill pxp-subsection-cta exp-input' id='addExp' type='button'>新增经历</button>");
                    expIsUpdating = 0;
                    $("#exp_msg").html("修改成功");
                }
            });

        }
    }
    function delExp()
    {
        if (expIsUpdating==1)
        {
            $("#exp_msg").html("现在正在修改信息，完成修改后再进行删除操作");
            return;
        }
        if (confirm("确认要删除这条经历吗？")) {
            let id = $(this).data("id");
            $.get("/web/personal/delOneExp",{id:id},function (mes){
                $("#exp_msg").html("删除成功");
                $(this).parent().parent().parent().parent().parent().remove();
            }.bind(this));

        }
    }

    function updateExp()
    {
        let id = $(this).data("id")
        if (expIsUpdating==0) {
            $("#addExp").remove();
            $(".weight").append("<button class='btn rounded-pill pxp-subsection-cta exp-input' id='updateExp' type='button' data-id='"+id+"'>更改经历</button>");
            expIsUpdating=1;
        }
        if ($(this).parent().parent().parent().parent().parent().css("color")!="rgb(255, 0, 0)") {
            $("#updateExp").attr("data-id",id);
            $(".exp").find("tr").css("color", "black");
            $(this).parent().parent().parent().parent().parent().css("color", "red");
            $("#pxp-candidate-work-title").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-title").html());
            $("#pxp-candidate-work-company").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-company").html());
            $("#pxp-candidate-work-time").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-time").data("in"));
            $("#pxp-candidate-work-endTime").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-time").data("out"));
            $("#pxp-candidate-work-about").val($(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-introduction").html());
            let positionTypeSecondId = $(this).parent().parent().parent().parent().parent().find(".pxp-candidate-dashboard-experience-introduction").data("position");
            $.get("/web/personal/getPositionTypeIdBySecond", {positionTypeSecondId: positionTypeSecondId}, function (mes) {
                $("#pxp-candidate-work-type").find("option[value='" + mes + "']").prop("selected", true);
                changePositionTypeSecond();
                $("#pxp-candidate-work-type-second").find("option[value='" + positionTypeSecondId + "']").prop("selected", true);

            });
        }
        else {
            $(".exp").find("tr").css("color", "black");
            $("#pxp-candidate-work-title").val("");
            $("#pxp-candidate-work-company").val("");
            $("#pxp-candidate-work-time").val("");
            $("#pxp-candidate-work-endTime").val("");
            $("#pxp-candidate-work-about").val("");
            let positionTypeSecondId = 1;
            $.get("/web/personal/getPositionTypeIdBySecond", {positionTypeSecondId: positionTypeSecondId}, function (mes) {
                $("#pxp-candidate-work-type").find("option[value='" + mes + "']").prop("selected", true);
                changePositionTypeSecond();
                $("#pxp-candidate-work-type-second").find("option[value='" + positionTypeSecondId + "']").prop("selected", true);

            });
            $("#updateExp").remove();
            $(".weight").append("<button class='btn rounded-pill pxp-subsection-cta exp-input' id='addExp' type='button'>新增经历</button>");
            expIsUpdating=0;
        }

        return false;
    }

    //添加工作经验
    function addExperience()
    {
        if($(".exp").find("tr").length>=5)
        {
            $("#exp_msg").html("最多录入五条工作经验");
            return;
        }
        if(checkExpName()){
            var name = $("#pxp-candidate-work-title").val();
            var companyName = $("#pxp-candidate-work-company").val();
            var inServiceTime = $("#pxp-candidate-work-time").val();
            var ins = inServiceTime.split("-");
            var inServiceTimeFmt=ins[0]+"年"+ins[1]+"月";
            var outServiceTime = $("#pxp-candidate-work-endTime").val();
            var outs = outServiceTime.split("-");
            var outServiceTimeFmt=outs[0]+"年"+outs[1]+"月";
            var introduction = $("#pxp-candidate-work-about").val();
            var positionTypeSecondId = $("#pxp-candidate-work-type-second").val();
            $.ajax({
                url:"/web/personal/addExp",
                type:"post",
                data:{
                    name:name,
                    companyName:companyName,
                    inServiceTime:inServiceTime,
                    outServiceTime:outServiceTime,
                    jobDescription:introduction,
                    positionTypeSecondId:positionTypeSecondId
                },
                success:function (mes)
                {
                    var trObj = $("<tr></tr>");
                    trObj.append("<td style='width: 30%;'><div class='pxp-candidate-dashboard-experience-title'>"+name+"</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-experience-company'>"+companyName+"</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-experience-time' data-in='"+inServiceTime+"' data-out='"+outServiceTime+"'>"+inServiceTimeFmt+" - "+outServiceTimeFmt+"</div></td>");
                    trObj.append("<td style='width: 20%;'><div class='pxp-candidate-dashboard-experience-introduction' data-position='"+positionTypeSecondId+"'>"+introduction+"</div></td>");
                    trObj.append("<td><div class='pxp-dashboard-table-options'><ul class='list-unstyled'><li><button title='修改'  class='updateExp' type='button' data-id='"+mes+"'><span class='fa fa-pencil'></span></button></li><li><button title='删除' class='delExp' type='button' data-id='"+mes+"'><span class='fa fa-trash-o'></span></button></li></ul> </div> </td>");
                    $(".exp").append(trObj);
                    $("#exp_msg").html("添加成功");
                    $("#pxp-candidate-work-title").val("");
                    $("#pxp-candidate-work-company").val("");
                    $("#pxp-candidate-work-time").val("");
                    $("#pxp-candidate-work-endTime").val("");
                    $("#pxp-candidate-work-about").val("");
                    positionTypeSecondId = 1;
                    $.get("/web/personal/getPositionTypeIdBySecond", {positionTypeSecondId: positionTypeSecondId}, function (mes) {
                        $("#pxp-candidate-work-type").find("option[value='" + mes + "']").prop("selected", true);
                        changePositionTypeSecond();
                        $("#pxp-candidate-work-type-second").find("option[value='" + positionTypeSecondId + "']").prop("selected", true);

                    });
                }
            });

        }
        return false;
    }

    //验证照片
    function checkPhoto()
    {
        var file = $("#pxp-candidate-photo-choose-file").val();
        if (file=="")
        {
            return true;
        }
        let index = file.lastIndexOf(".");
        if(index==-1)
        {
            $("#fileUp").html("传输文件有误");
            $("#pxp-candidate-photo-choose-file").focus();
            return false;
        }
        let exe = file.substring(index+1);
        if (!",jpg,png,jpeg,gif,webp,".includes(","+exe+","))
        {
            $("#fileUp").html("传输文件格式有误");
            $("#pxp-candidate-photo-choose-file").focus();
            return false;
        }
        $("#fileUp").html("");
        return true;
    }

    //验证详细信息
    function checkInfo()
    {
        var info = $("#pxp-candidate-about").val();
        if (info=="")
        {
            $("#about_msg").html("*必填");
            $("#pxp-candidate-about").focus();
            return false;
        }
        let zheng = /^.{10,2000}$/;
        if (!zheng.test(info))
        {
            $("#about_msg").html("描述至少10个字");
            $("#pxp-candidate-about").focus();
            return false;
        }
        $("#about_msg").html("");
        return true;
    }

    //验证求职状态
    function checkStatus()
    {
        var statusId = $("#pxp-candidate-excepted-status").val();
        if (statusId==0||statusId==null)
        {
            $("#status_msg").html("*必填");
            $("#pxp-candidate-excepted-status").focus();
            return false;
        }
        $("#status_msg").html("");
        return true;
    }

    //验证政治面貌
    function checkPoli()
    {
        var poli = $("#pxp-candidate-excepted-pol").val();
        if (poli=="")
        {
            $("#pol_msg").html("");
            return true;
        }
        let zheng = /^.{2,15}$/;
        if (!zheng.test(poli))
        {
            $("#pol_msg").html("政治面貌格式有误");
            $("#pxp-candidate-excepted-pol").focus();
            return false;
        }
        $("#pol_msg").html("");
        return true;
    }


    //验证现居地
    function checkNow()
    {
        var now = $("#pxp-candidate-now").val();
        if (now=="")
        {
            $("#now_msg").html("");
            return true;
        }
        let zheng = /^.{2,20}$/;
        if (!zheng.test(now))
        {
            $("#now_msg").html("现居地格式有误");
            $("#pxp-candidate-now").focus();
            return false;
        }
        $("#now_msg").html("");
        return true;
    }

    //验证籍贯
    function checkNative()
    {
        var native = $("#pxp-candidate-place").val();
        if (native=="")
        {
            $("#place_msg").html("");
            return true;
        }
        let zheng = /^.{2,20}$/;
        if (!zheng.test(native))
        {
            $("#place_msg").html("籍贯格式有误");
            $("#pxp-candidate-place").focus();
            return false;
        }
        $("#place_msg").html("");
        return true;
    }

    //验证婚姻状况
    function checkMarry()
    {
        var marry = $("#pxp-candidate-marry").val();
        if (marry=="")
        {
            $("#marry_msg").html("");
            return true;
        }
        if (marry=="已婚"||marry=="未婚"||marry=="离异"||marry=="丧偶")
        {
            $("#marry_msg").html("");
            return true;
        }
        $("#marry_msg").html("婚姻格式有误");
        $("#pxp-candidate-marry").focus();
        return false;
    }

    //验证民族
    function checkNation()
    {
        var nation = $("#pxp-candidate-national").val();
        if(nation=="")
        {
            return true;
        }
        let zheng = /^.{2,15}$/;
        if (!zheng.test(nation))
        {
            $("#national_msg").html("民族填写格式有误");
            $("#pxp-candidate-national").focus();
            return false;
        }
        $("#national_msg").html("");
        return true;
    }

    //验证qq
    function checkQQ()
    {
        var qq = $("#pxp-candidate-qq").val();
        if (qq=="")
        {
            return true;
        }
        let zheng = /^[0-9]{5,13}$/;
        if (!zheng.test(qq))
        {
            $("#qq_msg").html("qq填写格式有误");
            $("#pxp-candidate-qq").focus();
            return false;
        }
        $("#qq_msg").html("");
        return true;
    }

    //验证生日
    function checkBirth()
    {
        var birth = $("#pxp-candidate-birth").val();
        if (birth==""||birth==null)
        {
            $("#birth_msg").html("*必填");
            $("#pxp-candidate-birth").focus();
            return false;
        }
        let today = new Date();
        let birthYear = birth.split("-")[0];
        if (today.getFullYear()-parseInt(birthYear)<=16)
        {
            $("#birth_msg").html("年龄小于16岁，不允许进本网站哟");
            $("#pxp-candidate-birth").focus();
            return false;
        }
        $("#birth_msg").html("");
        return true;
    }

    //验证手机号码
    function checkPhone()
    {
        var phone = $("#pxp-candidate-phone").val();
        if (phone=="")
        {
            $("#phone_msg").html("*必填");
            $("#pxp-candidate-phone").focus();
            return false;
        }
        let zheng = /^1[0-9]{10}$/;
        if (!zheng.test(phone))
        {
            $("#phone_msg").html("*手机号码填写有误");
            $("#pxp-candidate-phone").focus();
            return false;
        }
        $("#phone_msg").html("");
        return true;
    }

    //验证邮箱
    function checkEmail()
    {
        var email = $("#pxp-candidate-email").val();
        if (email=="")
        {
            $("#email_msg").html("*必填");
            $("#pxp-candidate-email").focus();
            return false;
        }
        let zheng = /^.{2,20}@.{3,15}$/;
        if (!zheng.test(email))
        {
            $("#email_msg").html("邮箱格式有误");
            $("#pxp-candidate-email").focus();
            return false;
        }
        $("#email_msg").html("");
        return true;
    }

    //验证专业
    function checkMajor()
    {
        var major = $("#pxp-candidate-major").val();
        if (major=="")
        {
            return true;
        }
        let zheng = /^.{3,30}$/;
        if (!zheng.test(major))
        {
            $("#major_msg").html("专业填写格式有误");
            $("#pxp-candidate-major").focus();
            return false;
        }
        $("#major_msg").html("");
        return true;
    }


    //验证毕业院校
    function checkSchool()
    {
        var school = $("#pxp-candidate-school").val();
        if (school=="")
        {
            $("#school_msg").html("*必填");
            $("#pxp-candidate-school").focus();
            return false;
        }
        let zheng = /^.{3,50}$/;
        if (!zheng.test(school))
        {
            $("#school_msg").html("学校格式有误");
            $("#pxp-candidate-school").focus();
            return false;
        }
        $("#school_msg").html("");
        return true;
    }

    //验证名字
    function checkName()
    {
        var name = $("#pxp-candidate-name").val();
        if (name==""||name==null)
        {
            $("#name_msg").html("*必填");
            $("#pxp-candidate-name").focus();
            return false;
        }
        let zheng = /(^[\u4e00-\u9fa5]{2,5})|([a-zA-Z]{2,20})$/;
        if (!zheng.test(name))
        {
            $("#name_msg").html("名字格式有误");
            $("#pxp-candidate-name").focus();
            return false;
        }
        $("#name_msg").html("");
        return true;
    }

    //验证性别
    function checkSex()
    {
        var sex = $("#pxp-candidate-sex").val();
        if (sex==null)
        {
            $("#sex_msg").html("*必填");
            $("#pxp-candidate-sex").focus();
            return false;
        }
        $("#sex_msg").html("");
        return true;
    }

    //初始化
    function init()
    {
        var sex = "${requestScope.user.sex}";
        if (sex!=""){
            $("#pxp-candidate-sex").find("option").each(function (){
               if ($(this).val()==sex)
               {
                   $(this).prop("selected",true);
               }
            });
        }
        var jobStatusId = "${requestScope.user.jobStatusId}";
        if (jobStatusId!="")
        {
            $("#pxp-candidate-excepted-status").find("option").each(function (){
               if ($(this).val()==jobStatusId)
               {
                   $(this).prop("selected",true);
               }
            });
        }

        var face = "${requestScope.user.face}";
        if (face!="")
        {
            $("#yu_lan").css("background-image","url(/static/uploadImages/"+face+")");
        }

        changePositionTypeSecond();
    }

    function addTec()
    {
        let tecInfo = $("#tec").val();
        if (tecInfo=="")
        {
            $("#tec_msg").html("请输入文字后再进行添加");
            return false;
        }
        let zheng = /^.{2,20}$/;
        if (zheng.test(tecInfo)) {
            if ($("#exist_tec").find("li").length<10) {
                let exist = 0;
                $("#exist_tec").find("[class='label']").each(function (){
                   if ($(this).html()==tecInfo)
                   {
                       exist = 1;
                       return;
                   }
                });
                if (exist==0) {
                    $.ajax({
                        url:"/web/personal/addTec",
                        type:"post",
                        data:{
                            technologyLabel:tecInfo
                        },
                        success:function (mes)
                        {
                            $("#tec_msg").html("添加成功");
                            $("#tec").val("");
                            $("#exist_tec").append("<li><span class='label'>" + tecInfo + "</span><span class='fa fa-trash-o delTec' data-id='"+mes+"'></span></li>");
                        }
                    });
                }
                else {
                    $("#tec_msg").html("你已经存在这个标签了");
                }
            }
            else
            {
                $("#tec_msg").html("最多添加10个");
            }

        }
        else
        {
            $("#tec_msg").html("内容格式有误");
        }

        return false;
    }

    function changePositionTypeSecond()
    {
        let positionTypeId = $("#pxp-candidate-work-type").val();
        $.ajax({
           url:"/web/personal/changePositionTypeSecond",
           type:"post",
           data:{
              positionTypeId:positionTypeId
           } ,
            dataType:"json",
            async:false,
            success:function (mes){
               $("#pxp-candidate-work-type-second").html("");
                for (let i = 0; i < mes.length; i++) {
                    $("#pxp-candidate-work-type-second").append("<option value='"+mes[i].id+"'>"+mes[i].typeName+"</option>");
                }
            }
        });
    }

    // 点击按钮
    var button = document.getElementById("yuLanButton");
    var modal = document.getElementById("modal");
    modal.style.display = "none";
    button.onclick = function () {
        if (true) {
            $.ajax({
                url:"/web/personal/previewResume",
                type:"post",
                success:function (mes)
                {
                    $("#modal").html(mes);
                    let birthYear = $("#birthYear").val();
                    if (birthYear!="")
                    {
                        let today = new Date();
                        let todayYear = today.getFullYear();
                        $("#user_age").html(todayYear-parseInt(birthYear)+"岁");
                    }
                    modal.style.display = "block";
                }
            })

        }
        else
        {
            alert("您还没有填写过简历，请保存好简历后再进行预览。");
        }
    };
    //   关闭按钮
    $("#modal").on("click","#close",function (){
        modal.style.display = "none";
    });

    //   点击其他领域(即弹窗背景)
    window.onclick = function(event){
        if(event.target ==modal){
            modal.style.display = "none"
        }
    }

</script>
</body>
</html>
